package com.ctg.auth.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ctg.auth.bean.Permisssion;
import com.ctg.auth.dao.UserMapper;
import com.ctg.auth.service.UserService;
@Service
public class UserServiceImpl implements UserService {
	
	@Resource
	private UserMapper userMapper;
	
	/**
	 * 根据用户名获取用户id
	 */
	@Override
	public int getUid(String userName,String userPassword) {
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("userName", userName);
		map.put("userPassword", userPassword);
		return userMapper.getUid(map);
	}
	
	/**
	 * 根据用户id获取用户的操作权限
	 */
	@Override
	public List<Permisssion> getUserAuth(int uid) {
		// TODO Auto-generated method stub
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("uid", uid);
		return userMapper.getUserAuth(map);
	}

}
